package cn.edu.cdu.group4nb.controller;

import cn.edu.cdu.group4nb.po.Education;
import cn.edu.cdu.group4nb.po.Institution;
import cn.edu.cdu.group4nb.service.EducationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
public class EducationController {
    @Autowired
    private EducationService EducationService;
    @ResponseBody
    @GetMapping("/EducationManager/selectEducation")
    public List<Education> selectPosition (){
        return EducationService.selectEducation();
    }

    @ResponseBody
    @PostMapping("/EducationManager/addEducation")
    public int insertInstitution(@RequestBody Education education){
        return EducationService.insertEducation(education);
    }
    @ResponseBody
    @PostMapping("/EducationManager/delEducation")
    public Boolean stuDeleteCourse(@RequestBody int[] education_id){
        return EducationService.delEducation(education_id);
    }
    @ResponseBody
    @PostMapping("/EducationManager/updEducation")
    public int updInstitution(@RequestBody Education education){
        String jsonResult =com.alibaba.fastjson.JSON.toJSONString(education);
        System.out.print(jsonResult);
        return EducationService.updEducation(education);
    }
}
